<?php
  include "./core/mysql.php";
   session_start();
   $aar = $_SESSION['name'];
   $pass =$_POST['pass'];
   $shuoshuo = $_POST['shuoshuo'];
   $email = $_POST['email'];
   $arr=array();
   if(empty($pass)){
	 $arr['code'] = -10012;
	 $arr['message'] = "密码为空";	
	 echo json_encode($arr);
	 exit();
 }
   //邮箱格式
   $checkmail="/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/";//定义正则表达式  
    if(isset($email) && $email!=""){            //判断文本框中是否有值                         
        if(preg_match($checkmail,$email)){                 //用正则表达式函数进行判断              
        }else{
        	$arr['code'] = -1;
	        $arr['message'] = "电子邮箱格式不正确";	
	        echo json_encode($arr);
	        exit();  
        }  
    }  
   $sql="UPDATE tbl_user SET password='$pass', email='$email', string='$shuoshuo' WHERE `name`='$aar'";
   $res = query($sql);
       $arr['code'] = 1;
	   $arr['message'] = "修改成功";	
	   echo json_encode($arr); 
?>